﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsForms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
         /*   string name = textBox1.Text;
           // this.Text = name + "你好";
            this.Text = string.Format("{0}你好", name);
          //  MessageBox.Show(name + "你好");*/
            textBox1.Hide();
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            int i;
            int j;
            if(int.TryParse(textBox1.Text,out i) && int.TryParse(textBox2.Text,out j))
            {
                int sum = i + j;
                string str = string.Format("两数之和为{0}", sum);
                MessageBox.Show(str);
            }
            else if (!(int.TryParse(textBox1.Text, out i)) && int.TryParse(textBox2.Text, out j))
            {
                MessageBox.Show("窗口1为非整数类型，请重新输入！");
            }
            else if (int.TryParse(textBox1.Text, out i) && !(int.TryParse(textBox2.Text, out j)))
            {
                MessageBox.Show("窗口2为非整数类型，请重新输入！");
            }
            else
            {
                MessageBox.Show("窗口1，2为非整数类型，请重新输入！");
            }
        }
    }
}
